home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_gen_floatingcrate.cog < prev    next >
Text File  |  1999-11-15  |  3KB  |  100 lines

  1. # Jones 3D Cog Script
  2. #
  3. # gen_FloatingCrate.cog
  4. #
  5. # Place a crate so that about 1/2m of the top of the crate is above the water.
  6. # Then add a frame about 1/4m lower.
  7. # The cog sleeps for a random amount of time before starting so you can have a pool
  8. # full of floating crates and they will all "bob" differently. 
  9. #
  10. # Rotate axis: 0 = pitch, 1 = yaw, 2 = roll
  11. #
  12. # [TRM] [MDR]
  13. #
  14. #
  15. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  16. #
  17. # ========================================================================================
  18.  
  19. symbols
  20.  
  21.     message     startup
  22.     message     removed
  23.  
  24.     thing       crate0
  25.     
  26.     # The following numbers work best with 10 degree angles (default)
  27.     # If you change the rotation angles, you'll have to readjust these numbers
  28.     flex        n_degrees=10    # How much to rotate on an axis
  29.     flex        bobSpeed=0.1    # How fast the crate goes up and down
  30.     flex        rotSpeed=4.0    # How fast the crate rotates
  31.     flex        pause=1.5       # Pause between movements
  32.     int         upAndDown=1     # crate will move up and down if set to 1
  33.     
  34.     float       randNum=20       
  35.  
  36. # ********************** MISC LOCAL STUFF *******************
  37.     int            n_Removed=0        local
  38.     int            n_MoveDir=0        local
  39.     int            n_RotDir=0        local
  40.     vector        vec_PYR            local
  41.  
  42. end
  43.  
  44. # ========================================================================================
  45.  
  46. code
  47.  
  48. # ========================================================================================
  49. startup:
  50.     
  51.     Sleep(Rand()*randNum);
  52.  
  53.     while ( !n_Removed )
  54.     {
  55.  
  56.         if ( n_RotDir == 1 ) n_RotDir = -1;
  57.         else n_RotDir = 1;
  58.  
  59.         vec_PYR = VectorSet(n_degrees * n_RotDir, n_degrees * n_RotDir, n_degrees * n_RotDir);
  60.  
  61.         n_MoveDir    = 1 - n_MoveDir;
  62.         if((!n_Removed) && (upAndDown == 1)) MoveToFrame(crate0, n_MoveDir, bobSpeed);
  63.         Sleep(pause);
  64.  
  65.         # Rotate to angles
  66.         if (!n_Removed) Rotate(crate0, VectorX(vec_PYR), 0, rotSpeed);
  67.         Sleep(pause);
  68.         if (!n_Removed) Rotate(crate0, VectorY(vec_PYR), 1, rotSpeed);
  69.         Sleep(pause);
  70.         if (!n_Removed) Rotate(crate0, VectorZ(vec_PYR), 2, rotSpeed);
  71.         Sleep(pause);
  72.  
  73.         n_MoveDir    = 1 - n_MoveDir;
  74.         if((!n_Removed) && (upAndDown == 1)) MoveToFrame(crate0, n_MoveDir, bobSpeed);
  75.         Sleep(pause);
  76.  
  77.         # Reset Rotations
  78.         if (!n_Removed) Rotate(crate0, -VectorX(vec_PYR), 0, rotSpeed);
  79.         Sleep(pause);
  80.         if (!n_Removed) Rotate(crate0, -VectorY(vec_PYR), 1, rotSpeed);
  81.         Sleep(pause);
  82.         if (!n_Removed) Rotate(crate0, -VectorZ(vec_PYR), 2, rotSpeed);
  83.         Sleep(pause);
  84.     }
  85.  
  86.     return;
  87.  
  88. # ========================================================================================
  89. removed:
  90.  
  91.     n_Removed = 1;
  92.  
  93.     return;
  94.  
  95.  
  96. # ========================================================================================
  97.  
  98. end
  99.  
  100.